<template>
  <view class="content">
    <v-tag tag="详情" />
    <!-- 视频 -->
    <view class="video" v-if="detail.video">
      <view class="video-control" v-if="!showVide" @click="handleVideo">
        <u-icon name="play-right-fill" size="60" color="#ffffff"></u-icon>
      </view>
      <video
        v-show="showVide"
        :src="baseUrl + detail.video.url"
        controls></video>
    </view>
    <!-- 属性参数 -->
    <view class="properties" v-if="detail.properties && detail.properties.length > 0">
      <view class="item" v-for="(item, index) in detail.properties" :key="index">
        <view class="name">{{item.name}}</view>
        <view class="value">{{item.value}}</view>
      </view>
    </view>
    <!-- 文本 -->
    <view class="text" v-html="detail.inText" v-if="detail.inText"></view>
    <!-- 图片 -->
    <view class="image-list" v-if="detail.inImages && detail.inImages.length > 0">
      <view class="image" v-for="(item, index) in detail.inImages" :key="index">
        <u--image lazy-load width="100%" height="100%" :fade="true" duration="450" mode="widthFix" :src="baseUrl + item"></u--image>
      </view>
    </view>
  </view>
</template>

<script>
import config from '../../../config/config'
import Tag from './Tag'

export default {
  props: ['detail', 'showVide'],
  components: {
    'v-tag': Tag
  },
  data() {
    return {
      baseUrl: config.baseUrl
    }
  },
  methods: {
    handleVideo() {
      this.$emit('handleVideo')
    }
  }
}
</script>

<style scoped lang="scss">
.content {
  font-size: 24rpx;
  margin: 20rpx 0;
  padding: 20rpx;
  background: white;
  border-radius: 10rpx;
  .text {
    line-height: 1.2em;
    margin: 20rpx 0;
  }
  ::v-deep {
    image {
      width: 100%;
    }
  }
  .video-control {
    width: 100%;
    height: 200px;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .video {
    //background: red;
    video {
      width: 100%;
    }
  }
}
.properties {
  padding: 20rpx;
  background: #f7f7f7;
  margin: 20rpx 0;
  border-radius: 10rpx;
  .item {
    display: flex;
    font-size: 24rpx;
    height: 80rpx;
    .name {
      width: 160rpx;
      color: #999999;
    }
    .value {
      flex: 1;
    }
  }
}
</style>
